package com.freak.wanandroid.model.home.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.freak.wanandroid.R;
import com.freak.wanandroid.bean.SystemClassChildrenEntity;

import java.util.List;

/**
 * @author: freak
 * @date: 2022/9/18
 */
public class SpecialSubscriptionAddedAdapter extends BaseQuickAdapter<SystemClassChildrenEntity, BaseViewHolder> {
    private static final String DEFAULT_SUBSCRIPTION = "进程启动相关";

    public SpecialSubscriptionAddedAdapter(int layoutResId, @Nullable List<SystemClassChildrenEntity> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, SystemClassChildrenEntity children) {
        baseViewHolder.setText(R.id.subscriptionName, children.getName());
        if (DEFAULT_SUBSCRIPTION.equals(children.getName())) {
            baseViewHolder.getView(R.id.imageViewSubtract).setBackgroundResource(R.drawable.subscription);
            baseViewHolder.getView(R.id.imageViewSubtract).setEnabled(false);
        }
        baseViewHolder.addOnClickListener(R.id.imageViewSubtract);
    }
}
